// $ANTLR 3.4 C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g 2012-11-28 16:14:49

package PL.prac10;


import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

import org.antlr.runtime.tree.*;


@SuppressWarnings({"all", "warnings", "unchecked"})
public class XMLParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "BARRA", "BLANCO", "CADENA", "COMENTARIO", "COMILLAS", "DIGITO", "EXCLAMACION", "GUIONES", "IGUAL", "LETRA", "MAYOR", "MENOR", "NUMERO", "PALABRA", "LISTA_INST"
    };

    public static final int EOF=-1;
    public static final int BARRA=4;
    public static final int BLANCO=5;
    public static final int CADENA=6;
    public static final int COMENTARIO=7;
    public static final int COMILLAS=8;
    public static final int DIGITO=9;
    public static final int EXCLAMACION=10;
    public static final int GUIONES=11;
    public static final int IGUAL=12;
    public static final int LETRA=13;
    public static final int MAYOR=14;
    public static final int MENOR=15;
    public static final int NUMERO=16;
    public static final int PALABRA=17;
    public static final int LISTA_INST=18;

    // delegates
    public Parser[] getDelegates() {
        return new Parser[] {};
    }

    // delegators


    public XMLParser(TokenStream input) {
        this(input, new RecognizerSharedState());
    }
    public XMLParser(TokenStream input, RecognizerSharedState state) {
        super(input, state);
    }

protected TreeAdaptor adaptor = new CommonTreeAdaptor();

public void setTreeAdaptor(TreeAdaptor adaptor) {
    this.adaptor = adaptor;
}
public TreeAdaptor getTreeAdaptor() {
    return adaptor;
}
    public String[] getTokenNames() { return XMLParser.tokenNames; }
    public String getGrammarFileName() { return "C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g"; }


    public static class entrada_return extends ParserRuleReturnScope {
        MiArbol tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "entrada"
    // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:18:1: entrada : bloque EOF -> ^( LISTA_INST ( bloque )* ) ;
    public final XMLParser.entrada_return entrada() throws RecognitionException {
        XMLParser.entrada_return retval = new XMLParser.entrada_return();
        retval.start = input.LT(1);


        MiArbol root_0 = null;

        Token EOF2=null;
        XMLParser.bloque_return bloque1 =null;


        MiArbol EOF2_tree=null;
        RewriteRuleTokenStream stream_EOF=new RewriteRuleTokenStream(adaptor,"token EOF");
        RewriteRuleSubtreeStream stream_bloque=new RewriteRuleSubtreeStream(adaptor,"rule bloque");
        try {
            // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:18:9: ( bloque EOF -> ^( LISTA_INST ( bloque )* ) )
            // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:18:11: bloque EOF
            {
            pushFollow(FOLLOW_bloque_in_entrada71);
            bloque1=bloque();

            state._fsp--;

            stream_bloque.add(bloque1.getTree());

            EOF2=(Token)match(input,EOF,FOLLOW_EOF_in_entrada73);  
            stream_EOF.add(EOF2);


            // AST REWRITE
            // elements: bloque
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (MiArbol)adaptor.nil();
            // 18:22: -> ^( LISTA_INST ( bloque )* )
            {
                // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:18:25: ^( LISTA_INST ( bloque )* )
                {
                MiArbol root_1 = (MiArbol)adaptor.nil();
                root_1 = (MiArbol)adaptor.becomeRoot(
                (MiArbol)adaptor.create(LISTA_INST, "LISTA_INST")
                , root_1);

                // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:18:38: ( bloque )*
                while ( stream_bloque.hasNext() ) {
                    adaptor.addChild(root_1, stream_bloque.nextTree());

                }
                stream_bloque.reset();

                adaptor.addChild(root_0, root_1);
                }

            }


            retval.tree = root_0;

            }

            retval.stop = input.LT(-1);


            retval.tree = (MiArbol)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (MiArbol)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "entrada"


    public static class bloque_return extends ParserRuleReturnScope {
        MiArbol tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "bloque"
    // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:19:1: bloque : etiquetaa linea etiquetac ;
    public final XMLParser.bloque_return bloque() throws RecognitionException {
        XMLParser.bloque_return retval = new XMLParser.bloque_return();
        retval.start = input.LT(1);


        MiArbol root_0 = null;

        XMLParser.etiquetaa_return etiquetaa3 =null;

        XMLParser.linea_return linea4 =null;

        XMLParser.etiquetac_return etiquetac5 =null;



        try {
            // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:19:8: ( etiquetaa linea etiquetac )
            // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:19:10: etiquetaa linea etiquetac
            {
            root_0 = (MiArbol)adaptor.nil();


            pushFollow(FOLLOW_etiquetaa_in_bloque91);
            etiquetaa3=etiquetaa();

            state._fsp--;

            adaptor.addChild(root_0, etiquetaa3.getTree());

            pushFollow(FOLLOW_linea_in_bloque93);
            linea4=linea();

            state._fsp--;

            adaptor.addChild(root_0, linea4.getTree());

            pushFollow(FOLLOW_etiquetac_in_bloque95);
            etiquetac5=etiquetac();

            state._fsp--;

            adaptor.addChild(root_0, etiquetac5.getTree());

            }

            retval.stop = input.LT(-1);


            retval.tree = (MiArbol)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (MiArbol)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "bloque"


    public static class linea_return extends ParserRuleReturnScope {
        MiArbol tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "linea"
    // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:20:1: linea : ( PALABRA | atrib | bloque )* ;
    public final XMLParser.linea_return linea() throws RecognitionException {
        XMLParser.linea_return retval = new XMLParser.linea_return();
        retval.start = input.LT(1);


        MiArbol root_0 = null;

        Token PALABRA6=null;
        XMLParser.atrib_return atrib7 =null;

        XMLParser.bloque_return bloque8 =null;


        MiArbol PALABRA6_tree=null;

        try {
            // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:20:7: ( ( PALABRA | atrib | bloque )* )
            // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:20:9: ( PALABRA | atrib | bloque )*
            {
            root_0 = (MiArbol)adaptor.nil();


            // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:20:9: ( PALABRA | atrib | bloque )*
            loop1:
            do {
                int alt1=4;
                int LA1_0 = input.LA(1);

                if ( (LA1_0==MENOR) ) {
                    int LA1_1 = input.LA(2);

                    if ( (LA1_1==PALABRA) ) {
                        alt1=3;
                    }


                }
                else if ( (LA1_0==PALABRA) ) {
                    int LA1_2 = input.LA(2);

                    if ( (LA1_2==IGUAL) ) {
                        alt1=2;
                    }
                    else if ( (LA1_2==MENOR||LA1_2==PALABRA) ) {
                        alt1=1;
                    }


                }


                switch (alt1) {
            	case 1 :
            	    // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:20:10: PALABRA
            	    {
            	    PALABRA6=(Token)match(input,PALABRA,FOLLOW_PALABRA_in_linea103); 
            	    PALABRA6_tree = 
            	    (MiArbol)adaptor.create(PALABRA6)
            	    ;
            	    adaptor.addChild(root_0, PALABRA6_tree);


            	    }
            	    break;
            	case 2 :
            	    // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:20:18: atrib
            	    {
            	    pushFollow(FOLLOW_atrib_in_linea105);
            	    atrib7=atrib();

            	    state._fsp--;

            	    adaptor.addChild(root_0, atrib7.getTree());

            	    }
            	    break;
            	case 3 :
            	    // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:20:24: bloque
            	    {
            	    pushFollow(FOLLOW_bloque_in_linea107);
            	    bloque8=bloque();

            	    state._fsp--;

            	    adaptor.addChild(root_0, bloque8.getTree());

            	    }
            	    break;

            	default :
            	    break loop1;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);


            retval.tree = (MiArbol)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (MiArbol)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "linea"


    public static class atrib_return extends ParserRuleReturnScope {
        MiArbol tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "atrib"
    // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:21:1: atrib : PALABRA IGUAL ^ CADENA ;
    public final XMLParser.atrib_return atrib() throws RecognitionException {
        XMLParser.atrib_return retval = new XMLParser.atrib_return();
        retval.start = input.LT(1);


        MiArbol root_0 = null;

        Token PALABRA9=null;
        Token IGUAL10=null;
        Token CADENA11=null;

        MiArbol PALABRA9_tree=null;
        MiArbol IGUAL10_tree=null;
        MiArbol CADENA11_tree=null;

        try {
            // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:21:7: ( PALABRA IGUAL ^ CADENA )
            // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:21:9: PALABRA IGUAL ^ CADENA
            {
            root_0 = (MiArbol)adaptor.nil();


            PALABRA9=(Token)match(input,PALABRA,FOLLOW_PALABRA_in_atrib116); 
            PALABRA9_tree = 
            (MiArbol)adaptor.create(PALABRA9)
            ;
            adaptor.addChild(root_0, PALABRA9_tree);


            IGUAL10=(Token)match(input,IGUAL,FOLLOW_IGUAL_in_atrib118); 
            IGUAL10_tree = 
            (MiArbol)adaptor.create(IGUAL10)
            ;
            root_0 = (MiArbol)adaptor.becomeRoot(IGUAL10_tree, root_0);


            CADENA11=(Token)match(input,CADENA,FOLLOW_CADENA_in_atrib121); 
            CADENA11_tree = 
            (MiArbol)adaptor.create(CADENA11)
            ;
            adaptor.addChild(root_0, CADENA11_tree);


            }

            retval.stop = input.LT(-1);


            retval.tree = (MiArbol)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (MiArbol)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "atrib"


    public static class etiquetaa_return extends ParserRuleReturnScope {
        MiArbol tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "etiquetaa"
    // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:22:1: etiquetaa : MENOR ! PALABRA ^ ( atrib )? MAYOR !;
    public final XMLParser.etiquetaa_return etiquetaa() throws RecognitionException {
        XMLParser.etiquetaa_return retval = new XMLParser.etiquetaa_return();
        retval.start = input.LT(1);


        MiArbol root_0 = null;

        Token MENOR12=null;
        Token PALABRA13=null;
        Token MAYOR15=null;
        XMLParser.atrib_return atrib14 =null;


        MiArbol MENOR12_tree=null;
        MiArbol PALABRA13_tree=null;
        MiArbol MAYOR15_tree=null;

        try {
            // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:22:11: ( MENOR ! PALABRA ^ ( atrib )? MAYOR !)
            // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:22:13: MENOR ! PALABRA ^ ( atrib )? MAYOR !
            {
            root_0 = (MiArbol)adaptor.nil();


            MENOR12=(Token)match(input,MENOR,FOLLOW_MENOR_in_etiquetaa129); 

            PALABRA13=(Token)match(input,PALABRA,FOLLOW_PALABRA_in_etiquetaa132); 
            PALABRA13_tree = 
            (MiArbol)adaptor.create(PALABRA13)
            ;
            root_0 = (MiArbol)adaptor.becomeRoot(PALABRA13_tree, root_0);


            // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:22:29: ( atrib )?
            int alt2=2;
            int LA2_0 = input.LA(1);

            if ( (LA2_0==PALABRA) ) {
                alt2=1;
            }
            switch (alt2) {
                case 1 :
                    // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:22:29: atrib
                    {
                    pushFollow(FOLLOW_atrib_in_etiquetaa135);
                    atrib14=atrib();

                    state._fsp--;

                    adaptor.addChild(root_0, atrib14.getTree());

                    }
                    break;

            }


            MAYOR15=(Token)match(input,MAYOR,FOLLOW_MAYOR_in_etiquetaa138); 

            }

            retval.stop = input.LT(-1);


            retval.tree = (MiArbol)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (MiArbol)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "etiquetaa"


    public static class etiquetac_return extends ParserRuleReturnScope {
        MiArbol tree;
        public Object getTree() { return tree; }
    };


    // $ANTLR start "etiquetac"
    // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:23:1: etiquetac : MENOR ! BARRA ! PALABRA ^ MAYOR !;
    public final XMLParser.etiquetac_return etiquetac() throws RecognitionException {
        XMLParser.etiquetac_return retval = new XMLParser.etiquetac_return();
        retval.start = input.LT(1);


        MiArbol root_0 = null;

        Token MENOR16=null;
        Token BARRA17=null;
        Token PALABRA18=null;
        Token MAYOR19=null;

        MiArbol MENOR16_tree=null;
        MiArbol BARRA17_tree=null;
        MiArbol PALABRA18_tree=null;
        MiArbol MAYOR19_tree=null;

        try {
            // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:23:11: ( MENOR ! BARRA ! PALABRA ^ MAYOR !)
            // C:\\Users\\Jose\\workspace\\prac10\\src\\main\\java\\analizadores\\XMLParser.g:23:13: MENOR ! BARRA ! PALABRA ^ MAYOR !
            {
            root_0 = (MiArbol)adaptor.nil();


            MENOR16=(Token)match(input,MENOR,FOLLOW_MENOR_in_etiquetac146); 

            BARRA17=(Token)match(input,BARRA,FOLLOW_BARRA_in_etiquetac149); 

            PALABRA18=(Token)match(input,PALABRA,FOLLOW_PALABRA_in_etiquetac152); 
            PALABRA18_tree = 
            (MiArbol)adaptor.create(PALABRA18)
            ;
            root_0 = (MiArbol)adaptor.becomeRoot(PALABRA18_tree, root_0);


            MAYOR19=(Token)match(input,MAYOR,FOLLOW_MAYOR_in_etiquetac155); 

            }

            retval.stop = input.LT(-1);


            retval.tree = (MiArbol)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (MiArbol)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }
    // $ANTLR end "etiquetac"

    // Delegated rules


 

    public static final BitSet FOLLOW_bloque_in_entrada71 = new BitSet(new long[]{0x0000000000000000L});
    public static final BitSet FOLLOW_EOF_in_entrada73 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_etiquetaa_in_bloque91 = new BitSet(new long[]{0x0000000000028000L});
    public static final BitSet FOLLOW_linea_in_bloque93 = new BitSet(new long[]{0x0000000000008000L});
    public static final BitSet FOLLOW_etiquetac_in_bloque95 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_PALABRA_in_linea103 = new BitSet(new long[]{0x0000000000028002L});
    public static final BitSet FOLLOW_atrib_in_linea105 = new BitSet(new long[]{0x0000000000028002L});
    public static final BitSet FOLLOW_bloque_in_linea107 = new BitSet(new long[]{0x0000000000028002L});
    public static final BitSet FOLLOW_PALABRA_in_atrib116 = new BitSet(new long[]{0x0000000000001000L});
    public static final BitSet FOLLOW_IGUAL_in_atrib118 = new BitSet(new long[]{0x0000000000000040L});
    public static final BitSet FOLLOW_CADENA_in_atrib121 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_MENOR_in_etiquetaa129 = new BitSet(new long[]{0x0000000000020000L});
    public static final BitSet FOLLOW_PALABRA_in_etiquetaa132 = new BitSet(new long[]{0x0000000000024000L});
    public static final BitSet FOLLOW_atrib_in_etiquetaa135 = new BitSet(new long[]{0x0000000000004000L});
    public static final BitSet FOLLOW_MAYOR_in_etiquetaa138 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_MENOR_in_etiquetac146 = new BitSet(new long[]{0x0000000000000010L});
    public static final BitSet FOLLOW_BARRA_in_etiquetac149 = new BitSet(new long[]{0x0000000000020000L});
    public static final BitSet FOLLOW_PALABRA_in_etiquetac152 = new BitSet(new long[]{0x0000000000004000L});
    public static final BitSet FOLLOW_MAYOR_in_etiquetac155 = new BitSet(new long[]{0x0000000000000002L});

}